%{
#include <stdio.h>
#include "interpretador.h"
#include "y.tab.h"
%}

%%
;                       return SEMICOLON; 
,                       return COMA; 
[(]                     return OPENPAR; 
[)]                     return CLOSEPAR; 

[+]                     return SUM; 
[-]                     return SUB; 
[*]                     return MULT; 
[/]                     return DIV; 
:=                      return ATTRIB; 
[=]                     return EQUALS; 
[<]                     return LESS; 
[>]                     return GREATER; 
[<][=]                  return LEQ; 
[>][=]                  return GEQ; 
or                      return OR; 
and			                return AND; 
sqrt 			              return SQRT; 

writeStr                return WRITESTR; 
writeVar                return WRITEVAR; 
writeln                 return WRITELN; 
read                    return READ; 

while			              return WHILE; 
for                    	return FOR;
to                      return TO ; 
downto			            return DOWNTO; 
do                      return DO ; 
end                     return END ; 
endfor                  return ENDFOR ; 
endw                    return ENDW ; 
endif                   return ENDIF ; 
if                      return IF; 
then                    return THEN ;
else                    return ELSE ; 
endp                    return ENDP ; 

global 			return GLOBAL;
local			return LOCAL;
call			return CALL;
proc			return PROC;
endproc			return ENDPROC;
main			return TOKENMAIN;

["].*["]                yylval.palavra=strdup(yytext); return STRING; 
[0-9]+                  yylval.num=atoi(yytext); return VALUE; 
[a-z]    	        yylval.palavra=strdup(yytext); return VARIABLE;
[a-zA-Z][a-zA-Z0-9]*	yylval.palavra=strdup(yytext); return IDENTIFIER;


\n                      /* ignora \n */;
[ \t]+                  /* ignora espaço */;
%%

int yywrap(){
	return 1;
}
